.netstandard distinctby iqueryable

56

.netstandard distinctby iqueryable -

public static IQueryable<TSource> DistinctBy<TSource, TKey>(
	this IQueryable<TSource> source,
    Expression<Func<TSource, TKey>> keySelector)
    {
    	return source.GroupBy(keySelector).Select(grouping => grouping.FirstOrDefault());
	}

Comments

Submit
0 Comments